#include "ArrayOptimizationSupervisor.h"
#include <memory.h>

using namespace std;
using namespace learn;

ArrayOptimizationSupervisor::ArrayOptimizationSupervisor(int _inputCount, int _outputCount) 
	: inputLength(_inputCount), targetLength(_outputCount) {
}

ArrayOptimizationSupervisor::~ArrayOptimizationSupervisor() {
}

void ArrayOptimizationSupervisor::addSample(float *input, float *output)  {
	inputs.insert(inputs.end(), &input[0], &input[inputLength]);
	outputs.insert(outputs.end(), &output[0], &output[targetLength]);
}

int ArrayOptimizationSupervisor::getSampleCount() {
	return inputs.size() / inputLength;
}

int ArrayOptimizationSupervisor::getInputLength() {
	return inputLength;
}

void ArrayOptimizationSupervisor::getInput(int index, float* outInput) {
	memcpy(outInput, &inputs[index * inputLength], inputLength * sizeof(float));
}

int ArrayOptimizationSupervisor::getTargetLength() {
	return targetLength;
}

void ArrayOptimizationSupervisor::getTarget(int index, float* outTarget) {
	memcpy(outTarget, &outputs[index * targetLength], targetLength * sizeof(float));
}
